package main.a_SimpleFactoryModel;

/**
 * Created by newtranx_011 on 2017/9/21.
 */
public class OperationFactory {

    public static Operation createOperation(String operate){
        Operation oper = null;
        char operChar = operate.charAt(0);
        switch (operChar){
            case '+':
                oper = new OperationAdd();
                break;
            case '-':
                oper = new OperationSub();
                break;
            case '*':
                oper = new OperationMul();
                break;
            case '/':
                oper = new OperationDiv();
                break;
        }
        return oper;
    }
}
